<?php


namespace App\Transformers\Store;


use App\Models\LiveAnchor;
use App\Models\SeckillUser;
use App\Models\StoreBargainUser;
use App\Models\StoreSeckill;
use App\Transformers\User\UserTransformer;
use League\Fractal\TransformerAbstract;

class StoreSeckillUserTransformer extends TransformerAbstract
{
    protected $availableIncludes = ['storeSeckill','user'];

    public function transform(SeckillUser $data)
    {
        return [
            'id' => $data->id,
            'seckill_id' => $data->seckill_id ?? "",
            'user_id' => $data->user_id ?? "",
            'seckill_price' => $data->seckill_price ?? "",
            'num' => $data->num ?? "",
            'status' => $data->statusEnum[$data->status] ?? "",
            'storeSeckill'=> $data->storeSeckill ?? "",
            'user'=> $data->user ?? "",
            'order'=> $data->order ?? "",
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
